﻿using _111.Service.Login.Model;
using guidHelper;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Mvc;
using MyDapperApi.Models;
using MyDapperApi.Services;
using MyDapperApi.Services.Auth;
using MyDapperApi.Services.Login;
using MyDapperApi.Services.QywxDocument.DigitalizationDemand;
using QYWXUpdate.DataModel;
using QYWXUpdate.DataModel.CheckInfo;

namespace MyDapperApi.Controllers;

[ApiController]
[Route("api/[controller]")]
public class LoginController : ControllerBase
{
    private readonly ILoginService _loginService;

    public LoginController(ILoginService loginService)
    {
        _loginService = loginService;
    }

    [HttpPost("Login")]
    public async Task<IActionResult> Login([FromBody]LoginRequest request)
    {
        var entity = new SgtqQueueDetailEntity();
        var users = await _loginService.Login(request);
        return Ok(users);
    }

    [HttpPost("Test")]
    public async Task<IActionResult> Test([FromBody] IdRequest request)
    {
        var entity = new SgtqQueueDetailEntity();
        var users = AesCbcHelper.Encrypt(request.Id, System.Text.Encoding.Default.GetBytes("xshAesKey1234567"), System.Text.Encoding.Default.GetBytes("1234567890abcdef"));
        return Ok(users);
    }
}